Real-Time Fluid Contamination Prediction Using Bilinear Programming

ABSTRACT

Methods and systems are described for estimating the level of contamination of downhole fluid and underlying composition using physical property measurements, and mathematical modeling of contamination functions and fluid property mixing laws. The proposed approaches enable computation of estimates of the pumping time needed to achieve a certain contamination threshold level and the determination of whether or not sampling is appropriate at the current point in time based on the predicted compositional properties of the formation fluid.

TECHNICAL FIELD

The present invention relates to the field of characterization of fluidcompositions in wellbores, and in particular to a technique forreal-time prediction of fluid contamination using bilinear programming.

BACKGROUND ART

Formation fluid obtained from a reservoir generally contains a number ofnatural constituents, such as water, super critical gas, and liquidhydrocarbons. In addition to these natural constituents, the compositionof the formation fluid may also include an artificial contaminant suchas filtrate including water-based mud or oil-based mud, used duringdrilling operations.

Constituents of this formation fluid may be identified by sampling thefluid and then conducting an analysis on the composition of the sampledfluid. The analysis is generally performed by making specialmeasurements of the fluid to characterize the composition and as suchinfer many properties of interest about the fluid. Knowledge of theseproperties is useful in characterizing the reservoir and in making manyengineering and business decisions.

Various tools can be used to perform analysis of downhole fluids. Forexample, spectrophotometers, spectrometers, spectrofluorometers,refractive index analyzers, and similar devices can be used to analyzedownhole fluids by utilizing appropriate sensors to measure the fluid'sspectral response. Another type of measurement that can be made onsampled fluid is taking density measurements. For example, densitymeasurements are sometimes made at fixed time intervals, and analyzed toestimate the sample's quality. The repeated density measurements can beused to plot the change in density over time.

Characteristics of this density-time plot can then be used to assess thecomposition and contamination level of the sampled fluid. Other types ofmeasurements that can be used in characterizing fluid compositioninclude monitoring density, pressure, temperature and the like.

Though various techniques have been used in the past for characterizingfluid composition of a fluid sample, most of these techniques lack thelevel of accuracy desired and may also be inefficient. For example, asample that is taken with too high a contaminant level may produceinaccurate or misleading results about the composition of the formationfluid. Historically, the problem is either handled by assuming that theexact properties of the filtrate and the formation are known, inaddition to the initial condition, or by simply watching the changingmeasurement of the mixture and waiting for a measurement plateau that isinterpreted as indicative of maximum achievable fluid purity.

BRIEF DESCRIPTION OF DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of this specification, illustrate an implementation of apparatusand methods consistent with the present invention and, together with thedetailed description, serve to explain advantages and principlesconsistent with the invention. In the drawings,

FIG. 1 is a schematic diagram illustrating application of real-timefluid contamination prediction using bilinear programming according toone embodiment.

FIG. 2 is a flowchart illustrating implementing a bilinear technique forpredicting contamination in an unknown fluid according to oneembodiment.

FIG. 3 is a block diagram illustrating a computer system for performingfluid composition characterization techniques according to oneembodiment.

DESCRIPTION OF EMBODIMENTS

In the following description, for purposes of explanation, numerousspecific details are set forth in order to provide a thoroughunderstanding of the invention. It will be apparent, however, to oneskilled in the art that the invention may be practiced without thesespecific details. In other instances, structure and devices are shown inblock diagram form in order to avoid obscuring the invention. Referencesto numbers without subscripts or suffixes are understood to referenceall instance of subscripts and suffixes corresponding to the referencednumber. Moreover, the language used in this disclosure has beenprincipally selected for readability and instructional purposes, and maynot have been selected to delineate or circumscribe the inventivesubject matter, resort to the claims being necessary to determine suchinventive subject matter. Reference in the specification to “oneembodiment” or to “an embodiment” means that a particular feature,structure, or characteristic described in connection with theembodiments is included in at least one embodiment of the invention, andmultiple references to “one embodiment” or “an embodiment” should not beunderstood as necessarily all referring to the same embodiment.

As used herein, the term “a computer system” can refer to a singlecomputer or a plurality of computers working together to perform thefunction described as being performed on or by a computer system.

As described in more detail below, various embodiments allow predictingthe percent (or fraction of) fluid contamination in real-time i.e., thevolume of the mud filtrate invading the formation fluid inside thepump-out tool relative to the total fluid volume. Although describedbelow in terms of spectroscopic measurements, any other measurable fluidproperties that satisfy a linear mixture can be used, including densityand refractive index. The techniques described below do not assume thatthe formation or the filtrate properties are directly measurable.Instead, the assumption is that only the property of the mixture can bemeasured. Thus these techniques are applicable in the most severe of allcases, and are often also the most practical as the filtrate used israrely exactly known. The techniques described below do not make anyassumptions about any particular initial condition, such as a knowninitial filtrate fraction at the first time tick.

The techniques described below employ a bilinear programming frameworkto predict bounds on the fraction of the contaminated fluid inreal-time. The description is written in terms of spectroscopicmeasurements, but the techniques can be used anywhere where the measuredmixture property is linear in terms of those of the mixture components,which may themselves be unknown but can be constrained within linearspaces. Bilinearity comes into play by virtue of the fact that we aresolving a linear mixture system of components where the componentsthemselves live in linear spaces.

FIG. 1 illustrates one application for performing fluid contaminationprediction techniques according to the present disclosure to predictcontamination of a formation fluid in a borehole. In this application ofFIG. 1, a downhole tool 110 analyzes fluid measurements from aformation. A conveyance apparatus 114 at the surface deploys thedownhole tool 110 in a borehole 116 using a drill string, a tubular, acable, a wireline, or other component 112.

The tool 110 can be any tool used for wireline formation testing,production logging, Logging While Drilling/Measurement While Drilling(LWD/MWD), or other operations. For example, the tool 110 as shown inFIG. 1 can be part of an early evaluation system disposed on a drillcollar of a bottomhole assembly having a drill bit 115 and othernecessary components. In this way, the tool 110 can analyze theformation fluids shortly after the borehole 116 has been drilled. Assuch, the tool 110 can be a Fluid-Sampling-While-Drilling (FSWD) tool.Alternatively, the tool 110 can be a wireline pump-out formation testing(WPFT) tool or any other type of testing tool.

In use, the tool 110 obtains formation fluids and measurements atvarious depths in the borehole 116 to determine properties of theformation fluids in various zones. To do this, the tool 110 can have aprobe 150, a measurement device 120, and other components for in-situsampling and analysis of formation fluids in the borehole 116. Ratherthan a probe 150, the tool 110 can have an inlet with straddle packersor some other known sampling component.

In general, any suitable type of formation testing inlet known in theart can be used, with some being more beneficial than others. Also, thedisclosed analysis can be used with any type of drilling mud, such asoil-based or water-based muds.

During the sampling process, measurements are recorded in a memory unit174, communicated or telemetered uphole for processing by surfaceequipment 130, or processed locally by a downhole controller 170. Eachof these scenarios is applicable to the disclosed fluid compositionanalysis.

Although only schematically represented, it will be appreciated that thecontroller 170 can employ any suitable processor 172, programinstructions, memory 174, and the like for achieving the purposesdisclosed herein. The surface equipment 130 can be similarly configured.As such, the surface equipment 130 can include a general-purposecomputer 132 and software 134 for achieving the purposes disclosedherein.

The tool 110 has a flow line 122 that extends from the probe 150 (orequivalent inlet) and the measurement section 120 through other sectionsof the tool 110. The inlet obtains fluid from the formation via theprobe 150, isolation packers, or the like. As noted above, any suitableform of probe 150 or isolation mechanism can be used for the tool'sinlet. For example, the probe 150 can have an isolation element 152 anda snorkel 154 that extend from the tool 110 and engage the boreholewall. A pump 127 lowers pressure at the snorkel 154 below the pressureof the formation fluids so the formation fluids can be drawn through theprobe 150.

In a particular measurement procedure of the probe 150, the tool 110positions at a desired location in the borehole 116, and an equalizationvalve (not shown) of the tool 110 opens to equalize pressure in thetool's flow line 122 with the hydrostatic pressure of the fluid in theborehole 116. A pressure sensor 164 measures the hydrostatic pressure ofthe fluid in the borehole. Commencing operations, the probe 150positions against the sidewall of the borehole 116 to establish fluidcommunication with the formation, and the equalization valve closes toisolate the tool 110 from the borehole fluids. The probe 150 then sealswith the formation to establish fluid communication.

At this point, the tool 110 draws formation fluid into the tool 110using a fluid pumping module and the like. Sensors in the tool 110measure the density and other physical properties of the fluid, andoptical sensors in the tool 110 measure the absorption spectrum of thesample fluid at various wavelength channels. At various points,components such as valves, channels, chambers, and the pump 127 on thetool 110 operate to draw fluid from the formation that can be analyzedin the tool 110 and/or stored in one or more sample chambers 126.Eventually, the probe 150 can be disengaged, and the tool 110 can bepositioned at a different depth to repeat the cycle.

Because the intention is to determine properties and constituents of theformation fluid, obtaining uncontaminated sampled fluid with the probe150 is important. The sampled fluid can be contaminated by drilling mudbecause the probe 150 has made a poor seal with borehole wall, becausemud filtrate has invaded the formation, and/or dynamic filtrationthrough the mudcake establishes an equilibrium inflow during pump-outoperations. Therefore, the fluid can contain hydrocarbon components(solids, liquids, and/or supercritical gas) as well as drilling mudfiltrate (e.g., water-based mud or oil-based mud) or other contaminants.The drawn fluid flows through the tool's flow line 122, and variousinstruments and sensors (120 and 124) in the tool 110 analyze the fluid.

For example, the probe 150 and measurement section 120 can have sensorsthat measure various physical parameters (i.e., pressure, flow rate,temperature, density, viscosity, resistivity, capacitance, etc.) of theobtained fluid, and a measurement device, such as a spectrometer or thelike, in a fluid analysis section 124 can determine physical andchemical properties of oil, water, and gas constituents of the fluiddownhole using optical sensors. Eventually, fluid directed via the flowline 122 can either be purged to the annulus or can be directed to thesample carrier section 126 where the samples can be retained foradditional analysis at the surface.

Additional components 128 of the tool 110 can hydraulically operatevalves, move formation fluids and other elements within the tool 110,can provide control and power to various electronics, and cancommunicate data via wireline, fluid telemetry, or other method to thesurface. Uphole, surface equipment 130 can have a surface telemetry unit(not shown) to communicate with the downhole tool's telemetrycomponents. The surface equipment 130 can also have a surface processor(not shown) that performs processing of the data measured by the tool110 in accordance with the present disclosure.

Because traditional techniques have been unable to predict when thelevel of filtrate contaminant will recede to a usable level, operatorshave needed to use inefficient techniques to attempt to ensure that acaptured sample is sufficiently clear of contaminants. The techniquesdescribed below can guide the physical sampling process in view of bothbusiness goals and constraints, allowing an operator to decide when tosample the fluid with a reasonable expectation of acceptable purity, aswell as allowing a forecast of how long fluid will need to be flushedthrough the tool before the purity reaches an acceptable level forcapturing a sample. Such a forecast may then be used to help determinetradeoffs between purity levels and expected operational cost.

Overview

In the most generic sense, this computational method allows theresolution of mixture component systems from related observations(measurements) wherein not only the mixture coefficients are unknown,but so are the components themselves, which can at best be constrainedfrom a priori knowledge. We employ the proposed method for the real-timeprediction of the fluid contamination fraction as the fluid sample isbeing cleaned up.

Formulation

At any fixed time tick i, we are given an observed spectrum, S_(i), ofthe fluid mixture. The fluid mixture can be categorized into a2-component system i.e., mud filtrate and formation fluid, where each isan aggregate mixture of underlying basis constituents. We are to inferthe fraction of each of the two aggregate components. Using Behr's law,we can write S_(i)=α_(i)FI+(1−α_(i))FO, where α_(i) is the filtratefraction at time tick i, FI is the filtrate spectrum, and FO is theformation fluid spectrum. A necessary condition for the inferability ofα₁ is that FI and FO are spectrally distinguishable i.e., FI≠FO. To seethis, observe that if FI=FO, then it follows that S_(i)=FI=FO Vi andtherefore α₁ is lost from the above equation. However, such a singularcase can be clearly identified by observing that the measured spectrumS_(i) becomes constant for all time ticks i. Under such singularity, theproblem is unsolvable. Spectral distinguishability is implicit to theassumption that the sequence (S_(i))_(i) is not constant as that wouldimmediately force FI≠FO. Having a time-varying observation sequence(S_(i))_(i) intrinsically imposes constraints on the contaminationfraction sequence (α_(i))_(i).

In the remainder of this disclosure, it will be assumed that FI and FOare inferrable from the sequence (S_(i))_(i) i.e., the sequence is notconstant with time.

Formally, the problem computationally reduces to finding the pair ofspectra FI and FO, and the contamination fraction sequence in discretetime steps i.e., (α_(i))_(i). The variables satisfy the following systemof equations:

$\left\{ {\quad\begin{matrix}{S_{i} =} & {{\alpha_{i}{FI}} + {\left( {1 - \alpha_{i}} \right)F\; O{\forall i}}} \\\; & {0 \leq \alpha_{i} \leq {1{\forall i}}}\end{matrix}} \right.$

Where, FI is a dead crude spectrum (i.e., no gasses) and FO is any liveor dead crude spectrum. As such, each of FI and FO lives in awell-defined respective linear (polyhedral) space P^(FI) and P^(FO) (SeeU.S. patent application Ser. No. 14/931,729, entitled “System and Methodfor Fluid Composition Characterization,” filed Nov. 3, 2015, on fluidcomposition prediction from spectral measurements with known basiscomponents, which is incorporated by reference in its entirety for allpurposes).

It can further be assumed that the sequence (α_(i))_(i) satisfiestemporal constraints in the form of

(1−τ)α_(i−1)≦α_(i)≦(1+τ)α_(i−1) ∀i>1

for some chosen threshold τ, i.e., the relative change in the filtratefraction with respect to the total non-invaded fraction as compared tothe previous time tick is contained within a margin of τ. Alternatively,external information on how to bound α_(i)∀i can be used if available(e.g., a near-wellbore simulator). The filtrate fraction for the firsttime tick is assumed to be within some known bounds i.e., α₁ ^(l)≦α₁≦α₁^(u). In the absence of a priori information, the most conservativerange for the initial bounds is presumed i.e., α₁ ^(l)=0 and α₁ ^(u)=1.

An additional temporal constraint on the evolution of the a sequence canbe constructed based on the expectation that the general trendcharacterizing the evolution of the sequence is decreasing withincreasing time steps. A negative general trend can be numericallystated in terms of some chosen filtering operation. For instance, if thefilter is chosen to be the simple moving average of α over a window ofsize w, then imposing a decreasing moving average translates to thisinequality:

${\frac{\sum\limits_{k = {i + 1}}^{i + w}\; \alpha_{k}}{w} - \frac{\sum\limits_{k = i}^{i + w - 1}\; \alpha_{k}}{w}} \leq \Delta^{-}$

for all possible starting time ticks i, chosen window size w, andnegative threshold Δ⁻. The particular filter based inequality above isequivalent to α_(i+w)−α_(i)≦Δ⁻. Other filtering schemes are possible(e.g., cumulative moving average).

To this end, a second singularity case is identified. Pumping fluidmixtures in the presence of water does not yield uniform measurements.This is because oil and water do not mix uniformly and as fluid is beingpumped, the tool might see a particular section (i.e., plug) of thefluid mixture at one time tick and the complete fluid mixture atanother. It is the manifestation of these plugs that breaks thefundamental spectral equation in terms of the two fluid componentsassumed constant throughout the pumping operation. We will assume that atime tick where a plug is manifested can be accurately identified everytime. This can be determined according to the operations outlined inU.S. patent application Ser. No. 14/931,729, for instance when it can bepredicted that the water fraction is above a certain high thresholdlevel. Alternatively, it can be also identified when the above system ofconstraints becomes infeasible (i.e., no such desired contaminationfraction sequence exists). As such, the set of all time ticks where noplugs are identified is denoted by I*.

Bilinear Optimization Problem

Because the 2-component spectral equation is only valid up to a certainmeasurement error in S_(i), the above formulation is amenable to anoptimization approach. In particular, we may seek to minimize the totalerrors over all time ticks, where the error at a time tick i is assessedvia the first norm of the difference vector, i.e.,∥S_(i)−(α_(i)FI+(1−α_(i))FO)∥₁, subject to all of the availableconstraints. Formally,

$\underset{\alpha,{FI},{FO}}{argmin}{\sum\limits_{i\; \in \; I^{*}}\; {{S_{i} - \left( {{\alpha_{i}{FI}} + {\left( {1 - \alpha_{i}} \right)F\; O}} \right)}}_{1}}$${subject}\mspace{14mu} {to}\mspace{20mu} \left\{ \begin{matrix}{\alpha_{1}^{l} \leq \alpha_{1} \leq \alpha_{1}^{u}} \\{{\left( {1 - \tau} \right)\alpha_{i - 1}} \leq \alpha_{i} \leq {\left( {1 + \tau} \right)\alpha_{i - 1}{\forall{i > 1}}}} \\{{\alpha_{i + w} - \alpha_{i}} \leq {\Delta^{-}{\forall i}}} \\{0 \leq \alpha_{i} \leq {1{\forall i}}} \\{{FI}\; \in \; P^{FI}} \\{{F\; O} \in P^{F\; O}}\end{matrix} \right.$

Define the slack variablesε_(i)=∥S_(i)−(α_(i)FI+(1−α_(i))FO)∥₁=Σ_(j)ε_(i,j)∀iεI* whereε_(i,j)=|S_(i,j)−(α_(i)FI_(j)+(1−α_(i))FO_(j))|∀iεI*,∀j and where i isthe time tick index and j is the spectral frequency index. The aboveoptimization problem can be equivalently expressed via defining ε_(i,j)in terms of the following double inequality:−ε_(i,j)≦S_(i,j)−(α_(i)FI_(j)+(1−α_(i))FO_(j))≦ε_(i,j)∀iεI*,∀j. Theabove constrained optimization problem can therefore be equivalentlyexpressed as follows,

$\underset{\alpha,{FI},{F\; O}}{argmin}{\sum\limits_{i}\; {\sum\limits_{j}\; ɛ_{i,j}}}$

${subject}\mspace{14mu} {to}\mspace{20mu} \left\{ \begin{matrix}{\alpha_{1}^{l} \leq \alpha_{1} \leq \alpha_{1}^{u}} \\{{\left( {1 - \tau} \right)\alpha_{i - 1}} \leq \alpha_{i} \leq {\left( {1 + \tau} \right)\alpha_{i - 1}{\forall{i > 1}}}} \\{{\alpha_{i + w} - \alpha_{i}} \leq {\Delta^{-}{\forall i}}} \\{{{- ɛ_{i,j}} \leq {S_{i,j} - \left( {{\alpha_{i}{FI}_{j}} + {\left( {1 - \alpha_{i}} \right)F\; O_{j}}} \right)} \leq {ɛ_{i,j}{\forall{i \in I^{*}}}}},{\forall j}} \\{0 \leq \alpha_{i} \leq {1{\forall i}}} \\{{FI}\; \in \; P^{FI}} \\{{F\; O} \in P^{FO}}\end{matrix} \right.$

Hence, computing the contamination fraction in real-time reduces tosolving a linear objective function subject to linear and bilinearconstraints. This class of optimization problems can be solved viaconstructing concave and convex envelopes around all unknown bilinearterms and then employing a branch-and-bound strategy as delineated inU.S. patent application Ser. No. 14/713,591 entitled “System and Methodfor Joint Inversion of Bed Boundaries and Petrophysical Properties fromBorehole Logs,” filed May 15, 2015, on inverting bed properties from bedboundary measurements, which is incorporated by reference in itsentirety for all purposes.

Predicting Contamination Fraction Bounds

Let O* stand for the optimal objective value of the bilinear programmingproblem above and refer to the optimal solution space as the set of allsolutions admitting O* per objective value i.e., the followingbipolyhedral set BP, i.e.,

${BP} = \left\{ {\left( {\alpha,{FI},{F\; O}} \right)\begin{matrix}{{\sum\limits_{i}\; {\sum\limits_{j}\; ɛ_{i,j}}} = O^{*}} \\{\alpha_{1}^{l} \leq \alpha_{1} \leq \alpha_{1}^{u}} \\{{\left( {1 - \tau} \right)\alpha_{i - 1}} \leq \alpha_{i} \leq {\left( {1 + \tau} \right)\alpha_{i - 1}{\forall{i > 1}}}} \\{{\alpha_{i + w} - \alpha_{i}} \leq {\Delta^{-}{\forall i}}} \\{{{- ɛ_{i,j}} \leq {S_{i,j} - \left( {{\alpha_{i}{FI}_{j}} + {\left( {1 - \alpha_{i}} \right)F\; 0_{j}}} \right)} \leq {ɛ_{i,j}{\forall{i \in I^{*}}}}},{\forall j}} \\{0 \leq \alpha_{i} \leq {1{\forall i}}} \\{{FI}\; \in \; P^{FI}} \\{{F\; O} \in P^{F\; O}}\end{matrix}} \right\}$

Computing the minimum and maximum optimal values for α₁ (respectively,α_(i) ^(l) and α_(i) ^(u) at any fixed time tick i can be achieved bysolving the following two optimization problems,

$\alpha_{i}^{l} = {\min\limits_{{({\alpha,{FI},{FO}})} \in {BP}}\alpha_{i}}$and$\alpha_{i}^{u} = {\max\limits_{{({\alpha,{FI},{F\; O}})} \in {BP}}\alpha_{i}}$

Note the above two optimization problems are of the same class as ofthat which calculates O*.

Practical Implementation

The size of the bilinear problems outlined thus far may grow arbitrarilyin terms of the number of time ticks. To avoid prohibitive computationaloverheads, we impose a maximum number of time ticks that may be solvedat once. This maximum can be chosen experimentally so that computationremains affordable for real-time applications (given a chosen timebudget). Starting at time tick 1, after the number of maximum time ticksis reached, the first time tick is discarded to allow for the newesttime tick. Discarding the first time tick translates to fixing thepredicted bounds on α₁ i.e., without further back-in-time updates to itafter new time ticks data are received. The process continues in asliding window fashion. This sliding window for overhead performanceimprovement is not to be confused with the sliding window in case of themoving average filter.

FIG. 2 is a flowchart of a technique 200 for implementing the bilineartechniques for which the equations above represent an approach topredicting contamination in an unknown fluid. In block 210, a sequenceof measurements is received, typically using a sliding window techniqueas described above. In block 220, the optimization objective and itsassociated constraints are set up given the measurements obtained inblock 210. In block 230, constraints on the filtrate fraction sequenceare obtained as outlined above.

In block 240, the constrained bilinear optimization problem is solvedand in block 250 minimum and maximum optimal values for the filtratefraction at every time tick i is computed. These minimum and maximumvalues are provided to the operator in block 260. Any desired techniquemay be used to provide the minimum and maximum optimal values to theoperator, including graphical and numerical displays. In someembodiments, these values may be used as input for automatically makingdecisions regarding the sampling procedure, including deciding when tostart sampling the fluid based on the computed minimum and maximumfiltrate fractions.

Referring now to FIG. 3, an example processing device 300 for use inperforming the fluid composition characterization techniques discussedherein according to one embodiment is illustrated in block diagram form.Processing device 300 may serve as processor in a tool, a server, acomputer, or the like. Example processing device 300 includes a systemunit 310 which may be optionally connected to an input device 360 andoutput device 370. A program storage device (PSD) 380 (sometimesreferred to as a hard disk, flash memory, or non-transitory computerreadable medium) is included with the system unit 310. Also includedwith system unit 310 is a communication interface 340 for communicationvia a network with other remote and/or embedded devices (not shown).Communication interface 340 may be included within system unit 310 or beexternal to system unit 310. In either case, system unit 310 will becommunicatively coupled to communication interface 340. Program storagedevice 380 represents any form of non-volatile storage including, butnot limited to, all forms of optical and magnetic memory, includingsolid-state, storage elements, including removable media, and may beincluded within system unit 310 or be external to system unit 310.Program storage device 380 may be used for storage of software tocontrol system unit 310, data for use by the processing device 300, orboth.

System unit 310 may be programmed to perform methods in accordance withthis disclosure. System unit 310 also includes one or more processingunits 320, input-output (I/O) bus 350 and memory 330. Access to memory330 can be accomplished using the input-output (I/O) bus 350.Input-output (I/O) bus 350 may be any type of interconnect includingpoint-to-point links and busses. Processing unit 320 may include anyprogrammable controller device including, for example, a suitableprocessor. Memory 330 may include one or more memory modules andcomprise random access memory (RAM), read only memory (ROM),programmable read only memory (PROM), programmable read-write memory,and solid-state memory.

Value of the Techniques

Prediction of the purity of the sampled fluid in real-time has a directimplication to operational decision making. In particular, such aprediction can be used to systematically guide the physical samplingprocess in view of both business goals and constraints. For instance, ifthe operator can determine that the fluid has attained sufficientpurity, then sampling can be initiated. The predicted discrete boundstime-series can also be used to forecast a model for the expectedduration needed to achieve a desired fluid purity before sampling. Theforecast model can be obtained by curve-fitting each of the twopredicted contamination fraction bounding curves. Such a forecast can,in turn, be used to decide whether to review the objective (requiredpurity) in view of the expected operational cost. Predictedcontamination fraction bounds can provide best and worst case scenarioswhich can help in managing risk and reward.

It is also conceivable that an operator may want to terminate thepumping process and initiate the sampling when these techniques canpredict that a particular constituent of interest or the sum thereof(e.g., total hydrocarbon from formation) is above a minimum fractionvalue even before the fluid has reached a sufficient purity. Predictingbounds on the fraction of any base constituent or sum of several can bedone in analogous fashion as outlined above for the bounds of thecontamination fraction.

Finally, it should be noted that this method although described withspectroscopic measurements, it is inherently applicable withmeasurements of any changing fluid properties such as density andrefractive index.

It is to be understood that the above description is intended to beillustrative, and not restrictive. For example, the above-describedembodiments may be used in combination with each other. Many otherembodiments will be apparent to those of skill in the art upon reviewingthe above description. The scope of the invention therefore should bedetermined with reference to the appended claims, along with the fullscope of equivalents to which such claims are entitled.

What is claimed is:
 1. A method of estimating a composition of awellbore fluid, comprising: receiving a sequence of measurements of thewellbore fluid, wherein the wellbore fluid comprises unknown fractionsof a formation fluid and a filtrate fluid, each of unknown composition;obtaining constraints on the sequence of the filtrate fractions;performing a constrained bilinear optimization that minimizes totalmeasurement error over the sequence of measurements subject to acollection of obtained constraints; computing a minimum and maximumoptimal value for the filtrate fraction at each of the sequence ofmeasurements; and providing the minimum and maximum optimal values forthe filtrate fraction to a well operator.
 2. The method of claim 1,wherein one of the obtained constraints on the sequence of the filtratefractions is based on initial conditions of the filtrate fraction. 3.The method of claim 1, wherein one of the obtained constraints on thesequence of the filtrate fractions is based on temporal constraints. 4.The method of claim 1, further comprising: forecasting a time durationbefore the filtrate fraction is below a predetermined threshold based onthe computed sequence of minimum and maximum values for the filtratefraction.
 5. The method of claim 3, wherein the temporal constraintsconstrain change in the filtrate fraction relative to the formationfluid fraction between members of the sequence of measurements within apredetermined margin value.
 6. The method of claim 3, wherein thetemporal constraints comprise external information on how to bound thefiltrate fraction at each of the sequence of measurements.
 7. The methodof claim 1, wherein one of the obtained constraints on the sequence ofthe filtrate fractions is based on a filtering operation.
 8. The methodof claim 7, wherein the filtering operation comprises computing a movingaverage of the filtrate fraction over a window of a predetermined size.9. The method of claim 1, wherein the sequence of measurements comprisesa sequence of spectroscopic measurements.
 10. The method of claim 9,wherein each of the sequence of measurements comprises a spectroscopicresponse that is due to a spectrum associated with the filtrate and itsfraction.
 11. The method of claim 10, wherein the spectrum associatedwith the filtrate exists in a linear polyhedral space.
 12. The method ofclaim 9, wherein each of the sequence of measurements comprises aspectroscopic response that is due to a spectrum associated with theformation fluid and its fraction.
 13. The method of claim 12, whereinthe spectrum associated with the formation fluid is a live or dead crudespectrum that exists in a linear polyhedral space.
 14. The method ofclaim 1, wherein the sequence of measurements comprises a sequence ofdensity measurements.
 15. The method of claim 1, wherein the sequence ofmeasurements comprises a sequence of refractive index measurements. 16.The method of claim 1, wherein the sequence of measurements comprises asliding window of measurements, and wherein the constrained bilinearoptimization and computation of minimum and maximum optimal values forthe filtrate fraction are repeatedly performed on the sliding window ofmeasurements.
 17. The method of claim 1, further comprising: initiatingsampling of the wellbore fluid responsive to a determination that thefiltrate fraction is below a predetermined threshold.
 18. The method ofclaim 1, further comprising: initiating sampling of the wellbore fluidresponsive to a determination that a total fraction of one or moreconstituents of interest is within a predetermined margin.
 19. Themethod of claim 1, wherein the filtrate fraction comprises unknowncontaminants.
 20. The method of claim 1, further comprising identifyingand using measurements over time ticks that exclude those where themeasurements correspond to only sections of the wellbore fluid based onpredicted total fractions of appropriate constituents or based onfiltrate fraction constraints violation.
 21. The method of claim 1,wherein each of the collection of obtained constraints is a linearconstraint or a bilinear constraint.
 22. The method of claim 1, whereincomputing a minimum and maximum optimal value for the filtrate fractionat each of the sequence of measurements comprises: solving anoptimization of a minimum value of the filtrate fraction over abipolyhedral set; and solving an optimization of a maximum value of thefiltrate fraction over the bipolyhedral set.
 23. A non-transitoryprogram storage device with instructions stored thereon, comprisinginstructions that when executed cause one or more processors to: receivea sequence of measurements of a wellbore fluid, wherein the wellborefluid comprises unknown fractions of a formation fluid and a filtratefluid, each of unknown composition; obtain constraints on the sequenceof the filtrate fractions; perform a constrained bilinear optimizationthat minimizes total measurement error over the sequence of measurementssubject to a collection of obtained constraints; compute a minimum andmaximum optimal value for the filtrate fraction at each of the sequenceof measurements; and provide the minimum and maximum optimal values forthe filtrate fraction to a well operator.
 24. The program storage deviceof claim 23, wherein one of the obtained constraints on the sequence ofthe filtrate fractions is based on a filtering operation.
 25. Theprogram storage device of claim 24, wherein the filtering operationcomprises computing a moving average of the filtrate fraction over awindow of a predetermined size.
 26. The program storage device of claim23, wherein the sequence of measurements comprises a sequence ofspectroscopic measurements.
 27. The program storage device of claim 26,wherein each of the sequence of measurements comprises a spectroscopicresponse that is due to a spectrum associated with the filtrate and itsfraction.
 28. The program storage device of claim 26, wherein each ofthe sequence of measurements comprises a spectroscopic response that isdue to a spectrum associated with the formation fluid and its fraction.29. The program storage device of claim 23, wherein the sequence ofmeasurements comprises a sequence of density measurements.
 30. Theprogram storage device of claim 23, wherein the sequence of measurementscomprises a sliding window of measurements, and wherein the constrainedbilinear optimization and computation of minimum and maximum optimalvalues for the filtrate fraction are repeatedly performed on the slidingwindow of measurements.
 31. The program storage device of claim 23,wherein the instructions further comprise instructions that whenexecuted cause at least some of the one or more processors to: initiatesampling of the wellbore fluid responsive to a determination that thefiltrate fraction is below a predetermined threshold.
 32. The programstorage device of claim 23, wherein the instructions further compriseinstructions that when executed cause at least some of the one or moreprocessors to: initiate sampling of the wellbore fluid responsive to adetermination that a total fraction of one or more constituents ofinterest is within a predetermined margin.
 33. The program storagedevice of claim 23, wherein the filtrate fraction comprises unknowncontaminants.
 34. The program storage device of claim 23, wherein theinstructions further comprise instructions that when executed cause theone or more processors to: identify and use measurements over time ticksthat exclude those where the measurements correspond to only sections ofthe wellbore fluid based on predicted total fractions of appropriateconstituents or based on filtrate fraction constraints violation. 35.The program storage device of claim 23, wherein each of the collectionof obtained constraints is a linear constraint or a bilinear constraint.36. The program storage device of claim 23, wherein the instructionsthat when executed cause the one or more processors to compute a minimumand maximum optimal value for the filtrate fraction at each of thesequence of measurements comprise instructions that when executed causethe one or more processors to: solve an optimization of a minimum valueof the filtrate fraction over a bipolyhedral set; and solve anoptimization of a maximum value of the filtrate fraction over thebipolyhedral set.
 37. A system, comprising: a processor; and a memoryhaving instructions stored therein, comprising instructions that whenexecuted cause the processor to: receive a sequence of measurements of awellbore fluid, wherein the wellbore fluid comprises unknown fractionsof a formation fluid and a filtrate fluid, each of unknown composition;obtain constraints on the sequence of the filtrate fractions; perform aconstrained bilinear optimization that minimizes total measurement errorover the sequence of measurements subject to a collection of obtainedconstraints; compute a minimum and maximum optimal value for thefiltrate fraction at each of the sequence of measurements; and providethe minimum and maximum optimal values for the filtrate fraction to awell operator.
 38. The system of claim 37, wherein one of the obtainedconstraints on the sequence of the filtrate fractions is based on afiltering operation.
 39. The system of claim 38, wherein the filteringoperation comprises computing a moving average of the filtrate fractionover a window of a predetermined size.
 40. The system of claim 37,wherein the sequence of measurements comprises a sequence ofspectroscopic measurements.
 41. The system of claim 40, wherein each ofthe sequence of measurements comprises a spectroscopic response that isdue to a spectrum associated with the filtrate and its fraction.
 42. Thesystem of claim 40, wherein each of the sequence of measurementscomprises a spectroscopic response that is due to a spectrum associatedwith the formation fluid and its fraction.
 43. The system of claim 37,wherein the sequence of measurements comprises a sequence of densitymeasurements.
 44. The system of claim 37, wherein the sequence ofmeasurements comprises a sliding window of measurements, and wherein theconstrained bilinear optimization and computation of minimum and maximumoptimal values for the filtrate fraction are repeatedly performed on thesliding window of measurements.
 45. The system of claim 37, wherein theinstructions further comprise instructions that when executed cause theprocessor to: initiate sampling of the wellbore fluid responsive to adetermination that the filtrate fraction is below a predeterminedthreshold.
 46. The system of claim 37, wherein the instructions furthercomprise instructions that when executed cause the processor to:initiate sampling of the wellbore fluid responsive to a determinationthat a total fraction of one or more constituents of interest is withina predetermined margin.
 47. The system of claim 37, wherein the filtratefraction comprises unknown contaminants.
 48. The system of claim 37,wherein the instructions further comprise instructions that whenexecuted cause the processor to: identify and use measurements over timeticks that exclude those where the measurements correspond to onlysections of the wellbore fluid based on predicted total fractions ofappropriate constituents or based on filtrate fraction constraintsviolation.
 49. The system of claim 37, wherein each of the collection ofobtained constraints is a linear constraint or a bilinear constraint.50. The system of claim 37, wherein the instructions that when executedcause the processor to compute a minimum and maximum optimal value forthe filtrate fraction at each of the sequence of measurements compriseinstructions that when executed cause the processor to: solve anoptimization of a minimum value of the filtrate fraction over abipolyhedral set; and solve an optimization of a maximum value of thefiltrate fraction over the bipolyhedral set.